package com.fmdj.bff.driver.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.stp.StpUtil;
import com.fmdj.bff.driver.controller.form.ReceiveNewOrderMessageForm;
import com.fmdj.bff.driver.service.NewOrderMessageService;
import com.fmdj.common.util.CommonResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

@RestController
@RequestMapping("/message/order/new")
@Tag(name = "NewOrderMessageController", description = "新订单消息Web接口")
public class NewOrderMessageController {

    @Autowired
    private NewOrderMessageService newOrderMessageService;

    @PostMapping("/receiveNewOrderMessage")
    @Operation(summary = "同步接收新订单消息")
//    @SaCheckLogin
    public CommonResult receiveNewOrderMessage() {
//        long driverId = StpUtil.getLoginIdAsLong();
        ReceiveNewOrderMessageForm form = new ReceiveNewOrderMessageForm();
//        form.setUserId(driverId);
          form.setUserId(1133057633616900097l);  /*测试司机抢单手动给数据*/
        ArrayList list = newOrderMessageService.receiveNewOrderMessage(form);

        return CommonResult.ok().put(CommonResult.RETURN_RESULT, list);
    }
}
